import TokenUtils from './token-utils'

export async function checkToken (token, {
  autoRefresh = true
} = {}) {
  const tokenUtils = new TokenUtils({
    uniId: this
  })
  return tokenUtils.checkToken(token, {
    autoRefresh
  })
}

export async function createToken ({
  uid,
  role,
  permission
} = {}) {
  const tokenUtils = new TokenUtils({
    uniId: this
  })
  return tokenUtils.createToken({
    uid,
    role,
    permission
  })
}

export async function refreshToken ({
  token
} = {}) {
  const tokenUtils = new TokenUtils({
    uniId: this
  })
  return tokenUtils.refreshToken({
    token
  })
}
